@Inject('$http')
class DocumentService {

  save(item) {
    return this.$http.post('/api/v1/document/add', item);
  }

  delete(id) {
    return this.$http.post('/api/v1/document/delete', id);
  }

  update(item) {
    return this.$http.patch('/api/v1/document/update', item);
  }

  get(id) {
    return this.$http({
      url: '/api/v1/document/get',
      method: 'GET',
      params: id,
    });
  }

  getBoxes(orgId) {
    return this.$http({
      url: '/api/v1/document/getDocumentConfigByOrgId',
      method: 'GET',
      params: { orgId },
    });
  }

  queryBox(orgType) {
    return this.$http({
      url: '/api/v1/document/getDocumentPrimaryDirectoryByOrgType',
      method: 'GET',
      params: { orgType },
    });
  }

  getDetailBox(boxId) {
    return this.$http({
      url: '/api/v1/document/getFolderByBoxId',
      method: 'GET',
      params: { boxId },
    });
  }

  query(param) {
    return this.$http.post('/api/v1/document/query', param);
  }
}

export default DocumentService;
